Stygian = Stygian or {}
Stygian.astrology = Stygian.astrology or {}

Stygian.astrology.planets = {
"Sun",
"Moon",
"Eroee",
"Sidiak",
"Tarox",
"Papaxi",
"Aapek",
}

Stygian.astrology.numtoSign = {
  "Volcano",
  "Antlers",
  "Crystals",
  "Dolphin",
  "Lion",
  "Crocodile",
  "Censer",
  "Spider",
  "Dragon",
  "Skull",
  "Bumblebee",
  "Glacier"
}

Stygian.astrology.signToNum = {
  Volcano = 1,
  Antlers = 2,
  Crystals = 3,
  Dolphin = 4,
  Lion = 5,
  Crocodile = 6,
  Censer = 7,
  Spider = 8,
  Dragon = 9,
  Skull = 10,
  Bumblebee = 11,
  Glacier = 12,
}

Stygian.astrology.effect = {
  "+4",
  "+1",
  "+2",
  "-2",
  "+3",
  "-1",
  "-3",
}

function Stygian_astroEffect(sign1, sign2)
  if type(sign1) == "string" then 
    sign1 = Stygian.astrology.signToNum[sign1]
  end
  if type(sign2) == "string" then 
    sign2 = Stygian.astrology.signToNum[sign2]
  end
  local basenum = sign2 - sign1
  if basenum == 0 then
    basenum = 0
  end
  basenum = math.abs(basenum)
  if basenum < 7 then 
    basenum = basenum
  else 
    basenum =  math.abs(basenum - 12)
  end
  basenum = basenum + 1
  return Stygian.astrology.effect[basenum]
end

Stygian.astrology.sphereEffects = {
  Volcano = "fire res",
  Antlers = "dex",
  Crystals = "psi res",
  Dolphin = "int",
  Lion = "cha",
  Crocodile = "phys res",
  Censer = "asph res",
  Spider = "writhe",
  Dragon = "mag res",
  Skull = "con",
  Bumblebee = "body spd",
  Glacier = "cold res",
}

Stygian.astrology.Sun = {
  Volcano = "fire",
  Antlers = "cutting",
  Crystals = "psychic",
  Dolphin = "cold",
  Lion = "cutting",
  Crocodile = "asphyxiation",
  Censer = "asphyxiation",
  Spider = "poison",
  Dragon = "fire",
  Skull = "blunt",
  Bumblebee = "poison",
  Glacier = "cold"
}

Stygian.astrology.cardinal = {
  "Volcano",
  "Dolphin",
  "Censer",
  "Skull"
}

Stygian.astrology.fixed = {
  "Antlers",
  "Lion",
  "Spider",
  "Bumblebee"
}

Stygian.astrology.mutable = {
  "Crystals",
  "Crocodile",
  "Dragon",
  "Glacier"
}

Stygian.astrology.mode = {
  Volcano = "Cardinal",
  Antlers = "Fixed",
  Crystals = "Mutable",
  Dolphin = "Cardinal",
  Lion = "Fixed",
  Crocodile = "Mutable",
  Censer = "Cardinal",
  Spider = "Fixed",
  Dragon = "Mutable",
  Skull = "Cardinal",
  Bumblebee = "Fixed",
  Glacier = "Mutable",
}

function Stygian_planetRayEffect(planet, sign)
  local mode = Stygian.astrology.mode[sign]
  return Stygian.astrology[planet][mode]
end

function Stygian_signRayEffect(sign)
  local effect = ""
  for _,planet in pairs(Stygian.astrology[sign]) do 
    if planet == "Sun" then 
    else
      effect = string.format("%s:%s", effect, Stygian_planetRayEffect(planet, sign))
    end
  end
  return effect
end

Stygian.astrology.Moon = {
  Cardinal = "hallucinate",
  Fixed = "dizziness",
  Mutable = "dementia"
}

Stygian.astrology.Eroee = {
  Cardinal = "sensitivity",
  Fixed = "peace",
  Mutable = "love"
}

Stygian.astrology.Sidiak = {
  Cardinal = "stupidity",
  Fixed = "epilepsy",
  Mutable = "confusion"
}

Stygian.astrology.Tarox = {
  Cardinal = "recklessness",
  Fixed = "asthma",
  Mutable = "impatience"
}

Stygian.astrology.Papaxi = {
  Cardinal = "ego dmg",
  Fixed = "health dmg",
  Mutable = "mana dmg"
}

Stygian.astrology.Aapek = {
  Cardinal = "aeon",
  Fixed = "anorexia",
  Mutable = "scabies"
}

